/**
 * Created by caelan on 2018/10/23.
 */
var calculateType = {
  html: function (isGroupByDay, calWayArray) {

    var name = {
          MaxCalWay: '最大值',
          AvgCalWay: '平均值',
          MinCalWay: '最小值',
          SumCalWay: '累计值'
        },
        html='<div class="pluginsDiv" data-show="'+ (String(isGroupByDay) === 'true') +'" style="'+ (String(isGroupByDay) === 'true' ? 'display: block;' : 'display: none;') +'" id="calTypePluginsDiv">';

    var options = '<option value="NoneCalWay">无类型</option>';
    for ( var i = 0, len = calWayArray.length; i < len; i++ ) {
      options += '<option value="'+ calWayArray[i] +'">'+ name[calWayArray[i]] +'</option>';
    }

    html += '<div class="layui-form-item pluginsSingleRows">' +
      '<label class="layui-form-label">计算类型:</label>' +
      '<div class="layui-input-block">' +
        '<select data-selected="" lay-filter="calTypeMulti" id="calTypeStaticSelect">'+ options +'</select>' +
      '</div>' +
    '</div>';

    html += '</div>';
    return html;
  },
  getData: function () {
    if ( $('#calTypePluginsDiv').attr('data-show') !== 'true' ) return;

      Global.postData.calWay = $('#calTypeStaticSelect').val();
      if($("#selectTypeSelect").val()=="History"){
    	  if(Global.currElementObj.isGroupByDay){
    		  Global.postData.historyCalWays=null;
    	  }else{
    		  Global.postData.historyCalWays=new Array();
    		  if($('#calTypeStaticSelect').val()!="NoneCalWay"){
    			  Global.postData.historyCalWays.push($('#calTypeStaticSelect').val());
    		  }
    	  }
      }
  },
  renderCallback: function () {



  }
};